<?php
namespace app\index\model;

use think\Model;

class LoginTokenModel extends Model
{

    protected $table = 'newzs_logintoken';


    public static function add_token($uid, $roletype, $token, $ip, $comid, $ktype, $ytype, $hour=10){
        $data = [
            'comid' => $comid,
            'uid' => $uid,
            'roletype' => $roletype,
            'token' => $token,
            'ip' => $ip,
            'ktype' => $ktype,
            'ytype' => $ytype,
            'enddt' => date('Y-m-d H:i:s', time()+3600*$hour),
            'optdt' => date('Y-m-d H:i:s'),
        ];
        return self::create($data);
    }



}
